<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Bootstrap v3.3.4 核心 CSS 文件 -->
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <script src="../js/jquery.min.js"></script>
    <!-- Bootstrap v3.3.4 核心 JavaScript 文件 -->
    <script src="../js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="../css/sqh_style_v2.0.css">
    <script src="../js/sqh_wap.js"></script>
    <script src="../js/sqh_js_v2.0.js"></script>
    <title>申请合作</title>
</head>
<body class="">

<div class="row bg_232323 color_fff padding_top_10 padding_bottom_10">
    <a href="http://www.baidu.com">
        <div class=" col-xs-2">
            <span class="icon iconfont color_fff" aria-hidden="true">&#xe608;</span>
        </div>
    </a>
    <div class="col-xs-8 text-center">
        <span class="font_18"  role="button" aria-expanded="false">申请合作</span>
    </div>
    <div class="col-xs-2">
        <div class="col-xs-2 text-right">
        </div>
    </div>
</div>

<div class="line_height_40px color_4996f6 text-center">
恭喜您，注册成功，请完善下列门店信息
</div>

<form>
<div class="line_height_40px container-fluid border_b_top_eee border_b_bottom_eee">
    <div class="">
        <div class="width_60px float_left">
            姓名
        </div>
        <div class="margin_left_60 relative">
            <input type="text" name="username" id="username" class="clear_border  all_width padding_right_25" placeholder="请输入姓名" maxlength="10">
            <span class="absolute padding_top_10" style="top: 0;right: 0;" onclick="clearNumber(this)">
                <img src="../img/tsdd/icon_del.png" onclick="" class="img-responsive width_20px ">
            </span>
        </div>
    </div>

    <div class="border_b_top_eee">
        <div class="width_60px float_left">
            门店码
        </div>
        <div class="margin_left_60 ">
            <input type="text" name="faceShopCode" id="faceShopCode" class="clear_border all_width" placeholder="请输入门店码">
        </div>
    </div>

    <div class="border_b_top_eee">
        <div class="">上传营业执照</div>
        <div class="col-xs-6 padding_bottom_10">
            <img src="../img/tsdd/applay_cooperation_icon.png" class="img-responsive" onclick="uploadLicense()">
        </div>
        <input type="file" name="businessLicence" id="businessLicence" class="display_none" id="license">
        <div class="clearfix"></div>
    </div>

    <div class="border_b_top_eee">
        <div class="">上传门店照片</div>
        <div class="col-xs-6 padding_bottom_10">
            <img src="../img/tsdd/applay_cooperation_add.jpg" class="img-responsive" onclick="uploadStore()">
        </div>
        <input type="file" name="facadeStore" id="facadeStore" class="display_none" id="store">
        <div class="clearfix"></div>
    </div>

</div>

<div class="container-fluid line_height_40px margin_top_15">
    <div class="btn_gray all_width font_16" onclick="btnCommit(this)" id="submitBtn">提交审核资料</div>
    <input type="submit" value="提交审核资料" class="display_none" id="formSubmit">
</div>
</form>

</body>

<script>
    $(function(){
        faceShopCode.onkeyup= changeBtn;
        username.onkeyup= changeBtn;
    });

    //检查是否输入，是否允许输入按钮
    function changeBtn(){
        var faceShopCode = document.getElementById("faceShopCode").value;
        var username = document.getElementById("username").value;
        if(faceShopCode.length>0 || username.length>1){
            $("#submitBtn").removeClass("btn_gray").addClass("btn_blue");
        }else{
            $("#submitBtn").removeClass("btn_blue").addClass("btn_gray");
        }
    }

    //选择营业执照附件
    function uploadLicense(){
        $("#businessLicence").click();
    }

    function clearNumber(obj){
        document.getElementById("username").value="";
        changeBtn();
    }

    //选择门店照片附件
    function uploadStore(){
        $("#facadeStore").click();
    }

    //判断是否添加了附件
    function isAddAttachFiles(target){
        if(document.getElementById(target).value.length > 0){
            return true;
        }else{
            alert("请选择上传附件")
            return false;
        }
    }

    //检查用户姓名
    function checkUserName(){
        var username = document.getElementById("username").value;
        if(username.length < 2){
            alert("姓名至少为2位");
            return false;
        }else{
            return true;
        }
    }

    //提交表单
    function btnCommit(obj){
        var currentObj = $(obj);
        if(currentObj.hasClass("btn_gray")){
            return false;
        }
        var faceShopCode = document.getElementById("faceShopCode").value;
        if(faceShopCode.length > 0 && checkUserName() && isAddAttachFiles("businessLicence") && isAddAttachFiles("facadeStore")){
            document.getElementById("formSubmit").click();
        }
    }
</script>

</html>
